<template>
  <view class="membership-card">
    <view class="card-header">
      <text class="card-title">量子会员</text>
      <text class="card-level">{{ level }}</text>
    </view>
    
    <view class="card-content">
      <view class="expire-info">
        <text class="expire-label">有效期至</text>
        <text class="expire-date">{{ expireDate }}</text>
      </view>
      
      <view class="card-decoration">
        <view class="circuit-line line1"></view>
        <view class="circuit-line line2"></view>
        <view class="circuit-line line3"></view>
        <view class="circuit-dot dot1"></view>
        <view class="circuit-dot dot2"></view>
      </view>
    </view>
    
    <view class="card-footer">
      <view class="benefits-list">
        <view 
          v-for="benefit in benefits" 
          :key="benefit.id" 
          class="benefit-item"
        >
          <uni-icons :type="benefit.icon" size="16" color="#00ffff"></uni-icons>
          <text class="benefit-title">{{ benefit.title }}</text>
        </view>
      </view>
    </view>
  </view>
</template>

<script setup>
defineProps({
  level: {
    type: String,
    default: 'BASIC'
  },
  expireDate: {
    type: String,
    default: '2025-12-31'
  },
  benefits: {
    type: Array,
    default: () => []
  }
});
</script>

<style>
.membership-card {
  width: 100%;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(20, 0, 20, 0.8));
  border-radius: 15px;
  padding: 20px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.2);
  border: 1px solid rgba(0, 255, 255, 0.3);
  box-sizing: border-box;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  border-bottom: 1px solid rgba(255, 0, 255, 0.3);
  padding-bottom: 10px;
  flex-wrap: wrap; /* 允许在需要时换行 */
  gap: 10px; /* 添加间距 */
}

.card-title {
  font-size: 18px;
  color: #ff00ff;
  font-weight: bold;
}

.card-level {
  font-size: 16px;
  color: #00ffff;
  font-weight: bold;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 3px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0, 255, 255, 0.5);
}

.card-content {
  position: relative;
  margin-bottom: 15px;
  min-height: 60px;
}

.expire-info {
  margin-bottom: 10px;
}

.expire-label {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin-right: 5px;
}

.expire-date {
  font-size: 14px;
  color: #fff;
}

.card-decoration {
  position: absolute;
  top: 0;
  right: 0;
  width: 80px; /* 减小宽度 */
  height: 60px;
}

.circuit-line {
  position: absolute;
  background-color: rgba(0, 255, 255, 0.5);
}

.line1 {
  width: 40px; /* 减小宽度 */
  height: 1px;
  top: 10px;
  right: 0;
}

.line2 {
  width: 1px;
  height: 30px;
  top: 10px;
  right: 40px; /* 调整位置 */
}

.line3 {
  width: 25px; /* 减小宽度 */
  height: 1px;
  top: 40px;
  right: 15px; /* 调整位置 */
}

.circuit-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #00ffff;
}

.dot1 {
  top: 8px;
  right: 38px; /* 调整位置 */
  animation: blink 2s infinite alternate;
}

.dot2 {
  top: 38px;
  right: 13px; /* 调整位置 */
  animation: blink 3s infinite alternate-reverse;
}

@keyframes blink {
  0% { opacity: 0.3; }
  100% { opacity: 1; }
}

.card-footer {
  border-top: 1px solid rgba(0, 255, 255, 0.3);
  padding-top: 15px;
}

.benefits-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px; /* 添加间距 */
}

.benefit-item {
  display: flex;
  align-items: center;
  margin-right: 10px;
  margin-bottom: 5px;
  max-width: 100%; /* 确保不超出容器 */
}

.benefit-title {
  font-size: 12px;
  color: #fff;
  margin-left: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
</style>
